package cn.iocoder.yudao.module.hs.dal.mysql.picktask;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.hs.dal.dataobject.picktask.PickTaskDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.hs.controller.admin.picktask.vo.*;

/**
 * 拣货任务 Mapper
 *
 * @author 航盛
 */
@Mapper
public interface PickTaskMapper extends BaseMapperX<PickTaskDO> {

    default PageResult<PickTaskDO> selectPage(PickTaskPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PickTaskDO>()
                .likeIfPresent(PickTaskDO::getCode, reqVO.getCode())
                .eqIfPresent(PickTaskDO::getShipOrderId, reqVO.getShipOrderId())
                .likeIfPresent(PickTaskDO::getShipOrderCode, reqVO.getShipOrderCode())
                .inIfPresent(PickTaskDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PickTaskDO::getTaskType, reqVO.getTaskType())
                .likeIfPresent(PickTaskDO::getRfidCode, reqVO.getRfidCode())
                .eqIfPresent(PickTaskDO::getWarehouseType, reqVO.getWarehouseType())
                .eqIfPresent(PickTaskDO::getWarehouseId, reqVO.getWarehouseId())
                .eqIfPresent(PickTaskDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(PickTaskDO::getAssignUserId, reqVO.getAssignUserId())
                .likeIfPresent(PickTaskDO::getAssignUserName, reqVO.getAssignUserName())
                .betweenIfPresent(PickTaskDO::getPickStartTime, reqVO.getPickStartTime())
                .betweenIfPresent(PickTaskDO::getPickCompleteTime, reqVO.getPickCompleteTime())
                .betweenIfPresent(PickTaskDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PickTaskDO::getId));
    }

}